<nz-breadcrumb class="breadcrumb">
  <nz-breadcrumb-item>
    <a routerLink="/Home">首页</a>
  </nz-breadcrumb-item>
  <nz-breadcrumb-item>招聘岗位列表</nz-breadcrumb-item>
</nz-breadcrumb>
<form nz-form class="search-form" [formGroup]="searchForm" (keydown.enter)="$event.preventDefault();onSearch()" nzLayout="inline">
  <nz-form-item>
    <nz-form-label nzFor="enterpriseName">企业名称</nz-form-label>
    <nz-form-control>
      <nz-input-group nzSearch [nzAddOnAfter]="enterpriseNameSuffixIconButton">
        <input nz-input formControlName="enterpriseName" placeholder="请选择企业名称" readonly />
      </nz-input-group>
      <ng-template #enterpriseNameSuffixIconButton>
        <button nz-button nzType="primary" nzSearch (click)="findEnterprise()"><nz-icon nzType="search" /></button>
      </ng-template>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzFor="jobTitle">岗位名称</nz-form-label>
    <nz-form-control>
      <input nz-input formControlName="jobTitle" placeholder="请输入岗位名称" />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzFor="departmentName">部门名称</nz-form-label>
    <nz-form-control>
      <nz-input-group nzSearch [nzAddOnAfter]="departmentNameSuffixIconButton">
        <input nz-input formControlName="departmentName" placeholder="请选择部门名称" readonly />
      </nz-input-group>
      <ng-template #departmentNameSuffixIconButton>
        <button nz-button nzType="primary" nzSearch (click)="findDepartment()"><nz-icon nzType="search" /></button>
      </ng-template>
    </nz-form-control>
  </nz-form-item>
  <button nz-button type="button" nzType="primary" [nzLoading]="searchLoading" (click)="onSearch()">查询</button>
  <button nz-button type="button" class="margin-button" (click)="onReset()">重置</button>
  <button nz-button type="button" class="margin-button" nzType="primary" (click)="onAdd()">新增</button>
  <button nz-button type="button" class="margin-button" nzType="primary" [nzLoading]="searchLoading" (click)="onExport()">导出</button>
</form>
<nz-table #basicTable [nzData]="listOfData" [nzTotal]="total" [nzLoading]="searchLoading" nzSize="small" [nzScroll]="{ x: 'auto' }">
  <thead>
    <tr>
      <th nzWidth="120px">企业名称</th>
      <th nzWidth="120px">岗位名称</th>
      <th nzWidth="120px">部门名称</th>
      <th nzWidth="120px">工作地点</th>
      <th nzWidth="120px">岗位类型</th>
      <th nzWidth="200px">岗位职责</th>
      <th nzWidth="200px">岗位要求</th>
      <th nzWidth="150px">薪资范围</th>
      <th nzWidth="150px">发布日期</th>
      <th nzWidth="150px">截止日期</th>
      <th nzWidth="100px">招聘人数</th>
      <th nzWidth="100px">状态</th>
      <th nzWidth="250px" [nzRight]="true">操作</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of basicTable.data">
      <td>{{data.enterpriseName}}</td>
      <td>{{data.jobTitle}}</td>
      <td>{{data.departmentName}}</td>
      <td>{{data.workLocation}}</td>
      <td>
        <ng-container *ngIf="data.jobType === 10">全职</ng-container>
        <ng-container *ngIf="data.jobType === 20">兼职</ng-container>
        <ng-container *ngIf="data.jobType === 30">实习</ng-container>
      </td>
      <td class="ellipsis">{{data.responsibilities}}</td>
      <td class="ellipsis">{{data.requirement}}</td>
      <td>
        <ng-container *ngIf="data.salaryRange === 1">3000~5000</ng-container>
        <ng-container *ngIf="data.salaryRange === 2">5001~10000</ng-container>
        <ng-container *ngIf="data.salaryRange === 3">10001~20000</ng-container>
        <ng-container *ngIf="data.salaryRange === 4">20001~30000</ng-container>
        <ng-container *ngIf="data.salaryRange === 5">30000以上</ng-container>
      </td>
      <td>{{data.postingDate}}</td>
      <td>{{data.closingDate}}</td>
      <td>{{data.headCount}}</td>
      <td>
        <ng-container *ngIf="data.status === 10">开放</ng-container>
        <ng-container *ngIf="data.status === 20">关闭</ng-container>
      </td>
      <td [nzRight]="true">
        <button nz-button type="button" nzType="primary" (click)="editRow(data.id)">编辑</button>
        <button nz-button type="button" nzDanger class="margin-button" (click)="delRow(data.id)">删除</button>
        <button nz-button type="button" class="margin-button" (click)="detailRow(data)">详情</button>
      </td>
    </tr>
  </tbody>
</nz-table>
<enterprise-selector (enterpriseSelectedEvent)="handleEnterpriseSelectedEvent($event)"></enterprise-selector>
<department-selector (departmentSelectedEvent)="handleDepartmentSelectedEvent($event)"></department-selector>
<job-description-add (addedEvent)="onAdded($event)"></job-description-add>
<job-description-view></job-description-view>
